package com.chenglu.android.restaurant.shop;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chenglu.android.R;
import com.chenglu.android.common.base.BaseActivity;
import com.chenglu.android.common.utils.LogUtils;
import com.chenglu.android.common.utils.StatusBarUtil;
import com.chenglu.android.restaurant.adapter.ShopPhotoAdapter;
import com.chenglu.android.restaurant.adapter.ShopStoryListAdapter;

import java.util.Arrays;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

public class ShopPhotoActivity extends BaseActivity {
    public static final String PHOTO = "photo";
    public static final String TITLE = "title";

    @BindView(R.id.ic_back)
    ImageView icBack;
    @BindView(R.id.ll_back)
    LinearLayout llBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.rv_shop_photo)
    RecyclerView rvShopPhoto;

    public String photo;
    public String title;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_shop_photo;
    }

    @Override
    protected void initView() {
        StatusBarUtil.immersive(this);
        StatusBarUtil.setPaddingSmart(this, toolbar);
        photo = getIntent().getStringExtra(PHOTO);
        title = getIntent().getStringExtra(TITLE);
        tvTitle.setText(title);

        List<String> photoList = Arrays.asList(photo.split(","));

        ShopPhotoAdapter shopStoryListAdapter = new ShopPhotoAdapter(mContext, photoList);
        rvShopPhoto.setLayoutManager(new LinearLayoutManager(mContext));
        rvShopPhoto.setAdapter(shopStoryListAdapter);


    }


    @OnClick(R.id.ll_back)
    public void onViewClicked() {
        finish();
    }
}
